<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<base href="<%=basePath %>" />
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>农资与农产品全程供应链物流平台-新增车辆信息</title>
	<meta name="kewywords" content="农资与农产品全程供应链物流平台"/>
	<meta name="description" content="农资与农产品全程供应链物流平台"/>
	<link href="css/style.css" type="text/css" rel="stylesheet"/>
	<link type="text/css" rel="stylesheet" href="css/jquery-ui.css" />	
	<script type="text/javascript" src="js/jquery-1.9.1.js"></script>
	<script type="text/javascript" src="js/jquery-ui.js"></script>
	<script type="text/javascript" src="js/dialog/lhgdialog.js?skin=default"></script>
	<script type="text/javascript">
		$(document).ready(function(){
			if($("#selectIds").val() != "" ){
				//alert($("#selectIds").val());
				var selectIds = $("#selectIds").val().split(",");
				// 选中车辆类型
				setSelectedValue("vehicleType",selectIds[0]);
				//alert($("#vehicleType").val());
				// 选中车辆品牌
				setSelectedValue("vehicleBrand",selectIds[1]);
				// 选中燃料类型
				setSelectedValue("fuelType",selectIds[2]);
				// 选中车辆状态
				setSelectedValue("state",selectIds[3]);
			}
				
			var birthday = $("#productionDate").val();
			var buyday = $("#intakeDate").val();	
			$("#birthday").val(birthday);
			$("#buyday").val(buyday);
			
		});
		function setSelectedValue(id,value){
			//alert(id + value);
			var obj = document.getElementById(id);
			//alert(obj);
				for( i = 0;obj.options.length > i; i++){
					if(obj.options[i].value == value){
						obj.options[i].selected = true;
						return;
					}
				}
		}
		$(function(){
			$("#buyday").datepicker({					
				changeMonth: true,
     			changeYear: true,
     			dateFormat: "yy-mm-dd",
     			showButtonPanel: true,
     			yearRange: "2000:2013",
     			closeText: "Close",
     			currentText: "Now"    			
			});
			$("#birthday").datepicker({					
				changeMonth: true,
     			changeYear: true,
     			dateFormat: "yy-mm-dd",
     			yearRange: "2000:2013",
     			closeText: "Close",
     			currentText: "Now" 
			});	
		});	
		function saveCheck(){
			if($.trim($("#vehicleNo").val()) == "" ){
				showTip("请输入车辆编号");
				return false;
			}
			if($.trim($("#licensePlateNo").val()) == "" ){
				showTip("请输入车牌号码");
				return false;
			}
			if($.trim($("#roadTransportNo").val()) == ""){
				showTip("请输入运输证件号");
				return false;
			}
			if($.trim($("#vehicleBrand").val()) == ""){
				showTip("请选择车辆品牌");
				return false;
			}
			if($.trim($("#vehicleTonnage").val()) == ""){
				showTip("请填写车辆吨位");
				return false;
			}
			if($.trim($("#engineModel").val()) == ""){
				showTip("请填写发动机型号");
				return false;
			}
			if($.trim($("#engineNo").val()) == ""){
				showTip("请填写发动机编码");
				return false;
			}
			if($.trim($("#ratedPower").val()) == ""){
				showTip("请填写车辆额定功率");
				return false;
			}
			if($.trim($("#displacement").val()) == ""){
				showTip("请填写车辆排量");
				return false;
			}
			if($.trim($("#birthday").val()) == ""){
				showTip("请填写车辆出厂日期");
				return false;
			}
			if($.trim($("#buyday").val()) == ""){
				showTip("请填写车辆购入日期");
				return false;
			}
			if($.trim($("#length").val()) == ""){
				showTip("请填写车长");
				return false;
			}
			if($.trim($("#width").val()) == ""){
				showTip("请填写车宽");
				return false;
			}
			if($.trim($("#height").val()) == ""){
				showTip("请填写车高");
				return false;
			}
						
			$("#productionDate").val($("#birthday").val());
			//alert($("#birthday").val());
			///alert(document.getElementById("productionDate"));
			$("#intakeDate").val($("#buyday").val());
			//alert(document.getElementById("intakeDate"));
			$("#vehicleInfo").submit();
		}
		function showTip(alertMessage){
		$.dialog({
			title: "提示",
		    time: 5,
		    lock: true,
		    content: alertMessage,
		    width: 160,
    		height: 80
		});
	}			
	</script>
</head>
<body>
<%@include file="top.jsp" %>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
	<tr>
		<td width="187" height="37" bgcolor="#e0e0e0" class="brt bbt">
			<div class="topleft fl">系统菜单栏</div>
		</td>
		<td bgcolor="#e7e7e7" class=" bbt">
			<div class="topleft fl">您现在的位置：<a href="#">首页</a>&nbsp;>&nbsp;<span>新增车辆</span></div>
		</td>
	</tr>
	<tr>
		<td width="187" height="100%" valign="top" bgcolor="#FFFFFF" class="brt">
			<div class="left_bk"> 
			<div class="menu2">
				<%@include file="database_left.jsp" %>        
			</div>
			</div>
		</td>
		<td align="left" valign="top" bgcolor="#FFFFFF">
			<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
				<tr>
					<td height="38" style="background:url(images/zz_tit.jpg) left top repeat-x;">
						<div class="tt_back fl">新增车辆</div>
						<div class="fr"><img src="images/tit_right.jpg" alt="" width="103" height="38" /></div>
					</td>
				</tr>
				<tr>
					<td class="borders btn">
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td bgcolor="#fffeee" style="border-bottom:#fee7bd solid 1px;" >
						<form action="saveVehicle" method="post" id="vehicleInfo">	
					   	<s:hidden name="selectIds" id="selectIds" />
						<s:hidden name="productionDate" id="productionDate"/>
						<s:hidden name="intakeDate" id="intakeDate"/>
						<div style="height:500px">
					    <table border="0" cellspacing="0" cellpadding="0" align="left" style="margin-top:20px;margin-left: 100px;margin-bottom: 20px; " >
					    	<tr style="height: 40px;">
					    		<td align="right" width="110px;"><span style="color: red">*</span>车辆编号：</td>
								<td  width="180px;">
									<input type="text" class="input_are w122" id="vehicleNo" name="vehicle.vehicleNo" value="${vehicle.vehicleNo}"/>
								</td>
								<td align="right" width="110px;"><span style="color: red">*</span>车牌号码：</td>
								<td  width="180px;">
									<input type="text" class="input_are w122" id="licensePlateNo" name="vehicle.licensePlateNo" value="${vehicle.licensePlateNo}"/>
								</td>											  			
							</tr>
							<tr style="height: 40px;">
								<td align="right"><span style="color: red">*</span>运输证件号：</td>
								<td width="180px;">
									<input type="text" id="roadTransportNo" class="input_are w122" name="vehicle.roadTransportNo" value="${vehicle.roadTransportNo}" />
								</td>	
								<td align="right"><span style="color: red">*</span>车辆类型：</td>
								<td width="180px;">
									<select id="vehicleType" name="vehicle.vehicleType" class="input_are w122">
										<option value="普通货车" selected>普通货车</option>
										<option value="箱式货车">箱式货车</option>
										<option value="封闭货车">封闭货车</option>
										<option value="平板货车">平板货车</option>
										<option value="集装厢车">集装厢车</option>
									</select>
								</td>
								
							</tr>
							<tr style="height: 40px;">								
								<td align="right"><span style="color: red">*</span>车辆品牌：</td>
								<td width="180px;">
									<select id="vehicleBrand" name="vehicle.vehicleBrand" class="input_are w122">
										<option value="">-----请选择-----</option>
										<option value="福田FOTON">福田FOTON</option>
										<option value="江淮JAC">江淮JAC</option>
										<option value="东风DFAC">东风DFAC</option>
										<option value="陕汽">陕汽</option>
										<option value="解放牌">解放牌</option>
										<option value="中国重汽">中国重汽</option>
										<option value="江铃JMC">江铃JMC</option>
									</select>
								</td>
								<td align="right">燃料类型：</td>
								<td width="180px;">
									<select id = "fuelType" name="vehicle.fuelType" class="input_are w122">
										<option value="汽油" selected>汽油</option>
										<option value="柴油">柴油</option>
										<option value="油气混合">油气混合</option>
									</select>
								</td>
							</tr>
							<tr style="height: 40px;">
								<td align="right"><span style="color: red">*</span>发动机型号：</td>
								<td width="180px;"><input type="text" id="engineModel" class="input_are w122" name="vehicle.engineModel" value="${vehicle.engineModel}" /></td>
								<td align="right"><span style="color: red">*</span>发动机编码：</td>
								<td width="180px;"><input type="text" id="engineNo" class="input_are w122" name="vehicle.engineNo" value="${vehicle.engineNo}" /></td>
							</tr>
							<tr style="height: 40px;">
								<td align="right"><span style="color: red">*</span>额定功率(kw)：</td>
								<td width="180px;"><input type="text" id="ratedPower" class="input_are w122" name="vehicle.ratedPower" value="${vehicle.ratedPower}" /></td>
								<td align="right" width="180px;"><span style="color: red">*</span>发动机排量(L)：</td>
								<td><input type="text" id="displacement" class="input_are w122" name="vehicle.displacement" value="${vehicle.displacement}" /></td>
							</tr>
							<tr style="height: 40px;">
								<td align="right">车辆吨位：</td>
								<td width="180px;">
									<input type="text" id="vehicleTonnage" class="input_are w122" name="vehicle.vehicleTonnage" value="${vehicle.vehicleTonnage}" />
								</td>
								<td align="right">车辆状态：</td>
								<td width="180px;">
									<select id = "state" name="vehicle.state" class="input_are w122">
										<option value="空闲" selected>空闲</option>
										<option value="出车">出车</option>
										<option value="维修">维修</option>
									</select>
								</td>
							</tr>
							<tr style="height: 40px;">
								<td align="right">车牌颜色：</td>
								<td width="180px;">
									<input type="text" id="plateColor" class="input_are w122" name="vehicle.plateColor" value="${vehicle.plateColor}" />
								</td>
								<td align="right">车身颜色：</td>
								<td width="180px;">
									<input type="text" id="vehicleColor" class="input_are w122" name="vehicle.vehicleColor" value="${vehicle.vehicleColor}" />
								</td>
								
							</tr>
							<tr style="height: 40px;">
								<td align="right"><span style="color: red">*</span>出厂日期：</td>
								<td width="180px;">
									<input type="text" id="birthday" class="input_are w122" name="birthday"  />
								</td>
								<td align="right"><span style="color: red">*</span>购入日期：</td>
								<td width="180px;">
									<input type="text" id="buyday" class="input_are w122" name="buyday"  />
								</td>
							</tr>
							
							<tr style="height: 40px;">
								<td align="right"><span style="color: red">*</span>车辆尺寸：</td>
								<td colspan="3" width="180px;">				  				
									<input type="text" id="length" style="width: 40px;" class="input_are w122"  name="vehicle.length" value="${vehicle.length}" size="10"/>长(m)
									<input type="text" id="width" style="width: 40px;" class="input_are w122" name="vehicle.width" value="${vehicle.width}" size="10"/>宽(m)
									<input type="text" id="height" style="width: 40px;" class="input_are w122" name="vehicle.height" value="${vehicle.height}" size="10"/>高(m)
								</td>				  			
							</tr>
							
							<tr style="height: 40px;">
								<td align="right">备注：</td>
								<td colspan="3" width="180px;">									
									<input type="text" name="vehicle.remark" value="${vehicle.remark}" style="width: 300px;" class="input_are w122"/>
								</td>
							</tr>
											  		
							<tr style="height: 40px;">
								<td colspan="2" align="center">
									<input type="button" style="cursor: pointer;" class="buttons" value="保  存" 
										onclick="saveCheck()" />
									</td>
								<td colspan="2" align="center">
									<input type="reset" style="cursor: pointer;" class="buttons" value="重  置" />
								</td>
							</tr>
						</table>
						</div>
					</form>
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>
		</td>
	</tr>
</table>

<div class="bottom">版权所有：安徽朗坤物联网</div>
</body>
</html>